import request from '@/utils/request'
import { baseURL } from '@/utils/request'

// 添加接口
export const verifyCodeAddService = (data) => {
  return request.post('api/verify-code/sys/add', data)
}

// 修改接口
export const verifyCodeUpdateService = (data) => {
  return request.post('api/verify-code/sys/update', data)
}

// 获取验证码信息
export const verifyCodeGetListService = async () => {
  const res = await request.get('api/verify-code/sys/get-list')
  for (const item of res.data.data) {
    item.imgPath = baseURL + item.imgPath
  }
  return res
}

// 删除验证码
export const verifyCodeDelService = (data) => {
  return request.post('api/verify-code/sys/del', data)
}

// 获取一个验证码
export const verifyCodeGetSingleService = async () => {
  const res = await request.get('api/verify-code/get-code')
  res.data.data.imgPath = baseURL + res.data.data.imgPath
  return res
}
